<!--
 * @Author: yanjikun
 * @Date: 2021-06-28 10:19:09
 * @LastEditors: yanjikun
 * @LastEditTime: 2022-04-12 17:07:45
 * @Description: file content
-->
<template>
  <svg aria-hidden="true" :class="svgClass">
    <use :xlink:href="iconName" />
  </svg>
</template>

<script lang="ts" setup>
import { computed } from 'vue'
import { svgIconProps } from './svg-icon'
const props = defineProps(svgIconProps)
defineOptions({
  name: 'YSvgIcon'
})
const iconName = computed(() => `#icon-${props.iconClass}`)
const svgClass = computed(() => 'svg-icon')
</script>

<style lang="less" scoped>
.svg-icon {
  position: relative;
  width: 20px;
  height: 20px;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;

  &::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    cursor: pointer;
    z-index: 1;
  }
}
</style>
